{% extends 'generic/object_edit.html' %}
{% load form_helpers %}

{% block form %}
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Interface</strong></div>
        <div class="panel-body">
            {% if form.instance.device %}
                <div class="form-group">
                    <label class="col-md-3 control-label required" for="id_device">Device</label>
                    <div class="col-md-9">
                        <p class="form-control-static">
                            <a href="{{ form.instance.device.get_absolute_url }}">{{ form.instance.device }}</a>
                        </p>
                    </div>
                </div>
            {% endif %}
            {% render_field form.name %}
            {% render_field form.label %}
            {% render_field form.type %}
            {% render_field form.enabled %}
            {% render_field form.parent %}
            {% render_field form.lag %}
            {% render_field form.mac_address %}
            {% render_field form.mtu %}
            {% render_field form.mgmt_only %}
            {% render_field form.mark_connected %}
            {% render_field form.description %}
            {% render_field form.tags %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading"><strong>802.1Q Switching</strong></div>
        <div class="panel-body">
            {% render_field form.mode %}
            {% render_field form.untagged_vlan %}
            {% render_field form.tagged_vlans %}
        </div>
    </div>
    {% if form.custom_fields %}
      <div class="panel panel-default">
        <div class="panel-heading"><strong>Custom Fields</strong></div>
        <div class="panel-body">
          {% render_custom_fields form %}
        </div>
      </div>
    {% endif %}
{% endblock %}

{% block buttons %}
    {% if obj.pk %}
        <button type="submit" name="_update" class="btn btn-primary">Update</button>
        <button type="submit" formaction="?return_url={% url 'dcim:interface_edit' pk=obj.pk %}" class="btn btn-primary">Update and Continue Editing</button>
    {% else %}
        <button type="submit" name="_create" class="btn btn-primary">Create</button>
        <button type="submit" name="_addanother" class="btn btn-primary">Create and Add Another</button>
    {% endif %}
    <a href="{{ return_url }}" class="btn btn-default">Cancel</a>
{% endblock %}